package com.zwxbc.funplay.service.impl;

import com.zwxbc.funplay.dao.PlayerDao;
import com.zwxbc.funplay.dao.impl.PlayerDaoImpl;
import com.zwxbc.funplay.entity.Player;
import com.zwxbc.funplay.service.GameService;
import com.zwxbc.funplay.service.PlayerGameLibraryService;
import com.zwxbc.funplay.service.PlayerService;

import java.util.List;

public class PlayerServiceImpl implements PlayerService {

	PlayerDao playerDao = new PlayerDaoImpl();
	GameService gameService = new GameServiceImpl();
	PlayerGameLibraryService playerGameLibraryService = new PlayerGameLibraryServiceImpl();
	@Override
	public Player playerLogin(Player player) {
		return playerDao.playerLogin(player);
	}

	@Override
	public List<Player> getPlayerList() {
		return playerDao.getAllPlayers();
	}

	@Override
	public boolean deletePlayer(Long playerId) {
		int result = playerDao.deletePlayer(playerId);
		return result > 0;
	}

	@Override
	public boolean updatePlayer(Player player) {
		int result = playerDao.updatePlayer(player);
		return result > 0;
	}

	@Override
	public boolean addPlayer(Player player) {
		int result = playerDao.addPlayer(player);
		return result > 0;
	}

	@Override
	public boolean isPlayerExists(String username, String contact, String email) {
		return playerDao.isPlayerExists(username, contact, email);
	}

	@Override
	public Player getPlayerById(Long playerId) {
		return playerDao.getPlayerById(playerId);
	}

	@Override
	public boolean playerUpdate(Player player) {
		int result = playerDao.playerUpdate(player);
		return result > 0;
	}

	@Override
	public Player getPlayerByUsername(String playerUsername) {
		return playerDao.getPlayerByUsername(playerUsername);
	}

}
